//
//  Constant.h
//  Dresshere
//
//  Created by 张朋 on 2017/12/19.
//  Copyright © 2017年 张朋. All rights reserved.
//

#ifndef Constant_h
#define Constant_h

#define WeakSelf(weakSelf)      __weak __typeof(&*self)    weakSelf  = self;

///------
/// Common
///------
#define  iPhoneX (SCREEN_WIDTH == 375.f && SCREEN_HEIGHT == 812.f ? YES : NO)

///------
/// Server
///------
#define kHost @"http://app.dresshere.cn/"   //正式环境
//#define kHost @"http://39.108.14.79:3000/"    //测试环境

///------
/// Device
///------
#define SafeAreaTopHeight ([UIScreen mainScreen].bounds.size.height == 812.0 ? 88 : 64)
#define iPhoneX [UIScreen mainScreen].bounds.size.height == 812.0 ? 1 : 0

///------
/// NSLog
///------

#ifdef DEBUG
#define NSLog(...) NSLog(__VA_ARGS__)
#else
#define NSLog(...) {}
#endif

#define kLogError(error) NSLog(@"Error: %@", error)

///------
/// Window、AppDelegate
///------
#define kKeyWindow          [UIApplication sharedApplication].keyWindow
#define kAppDelegate        ((AppDelegate*)[UIApplication sharedApplication].delegate)

///------
/// Color
///------

#define RGB(r, g, b) [UIColor colorWithRed:((r) / 255.0) green:((g) / 255.0) blue:((b) / 255.0) alpha:1.0]
#define RGBAlpha(r, g, b, a) [UIColor colorWithRed:((r) / 255.0) green:((g) / 255.0) blue:((b) / 255.0) alpha:(a)]

#define HexRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define HexRGBAlpha(rgbValue, a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:(a)]

#define kBlue [UIColor colorWithHexString:@"#1A82FF"]

///------
/// Block
///------

typedef void (^VoidBlock)();
typedef BOOL (^BoolBlock)();
typedef int  (^IntBlock) ();
typedef id   (^IDBlock)  ();

typedef void (^VoidBlock_int)(int);
typedef BOOL (^BoolBlock_int)(int);
typedef int  (^IntBlock_int) (int);
typedef id   (^IDBlock_int)  (int);

typedef void (^VoidBlock_string)(NSString *);
typedef BOOL (^BoolBlock_string)(NSString *);
typedef int  (^IntBlock_string) (NSString *);
typedef id   (^IDBlock_string)  (NSString *);

typedef void (^VoidBlock_id)(id);
typedef BOOL (^BoolBlock_id)(id);
typedef int  (^IntBlock_id) (id);
typedef id   (^IDBlock_id)  (id);

///-----------
/// ORDER_STATE
///-----------
typedef enum OrderState {
    OrderStateUnpaid = 7000, //待支付
    OrderStateUnshipments = 7001, //待发货
    OrderStateUnreceiving = 7002, //待收货
    OrderStateCompleted = 7003, //已完成
    OrderStateUnusual = 7007, //异常
    OrderStateCancel = 7008 //取消
} OrderState;

///-----------
/// Retrun_STATE
///-----------
typedef enum RetrunState {
    RetrunStateWaiting = 7004, //待归还
    RetrunStateReturnning = 70041, //归还中
    RetrunStateCompleted = 7005, //已归还
    RetrunStateCompensation = 7006, //损坏赔偿
} RetrunState;

///-----------
/// PAY_TYPE
///-----------
typedef enum PayType {
    PayTypeVip, //vip
    PayTypeOrder, //订单
    PayTypeCompensate //赔偿
} PayType;

///-----------
/// SEARCH_CONDITION
///-----------
typedef enum ConditionType {
    ConditionTypeColor, //颜色
    ConditionTypeScene, //场景
    ConditionTypeCategory, //分类
    ConditionTypeSize   //尺码
} ConditionType;

///-----------
/// USER_DEFAULT
///-----------
#define USER_SELECT_CITY @"user_selected_city"  //用户选择的城市
#define USER_SELECT_CATEGORY @"user_selected_category"  //用户选择的品类
#define USER_SELECT_SCENES @"user_selected_scenes"  //用户选择的场景
#define USER_SELECT_SEX @"user_selected_sex"  //未登录情况下，用户选择的性别
#define USER_HOME_ADDRESS @"user_home_address" //首页设置地址
#define USER_ORDER_BUY_ADDRESS @"USER_ORDER_BUY_ADDRESS" //用户购买、租赁地址
#define USER_ORDER_WASHING_ADDRESS @"USER_ORDER_WASHING_ADDRESS" //用户洗衣地址
#define USER_SEARCH_HISTORY @"USER_SEARCH_HISTORY" //用户搜索记录
#define USER_SALE_FILTER @"USER_SALE_FILTER" //用户特卖筛选条件

///-----------
/// SSKeychain
///-----------

#define MRC_SERVICE_NAME @"com.braspring.dresshere"
#define MRC_RAW_LOGIN    @"RawLogin"
#define MRC_PASSWORD     @"Password"
#define MRC_ACCESS_TOKEN @"AccessToken"

///-----------
/// 第三方key
///-----------
#define AMAP_KEY @"b2c617ab0f91c57de604dc96e0c06819"    //高德地图
#define QIYU_KEY @"4335718ce7208d7c0386cf1f5500328a"    //网易七鱼
#define WB_KEY @"3386794433"
#define WB_SECRET @"a4d3c50af4a596124007fc9280264f97"
#define WX_KEY @"wx06d62e8cb2e6048f"
#define WX_SECRET @"01d3717e08b8b43d309493b9f3cc08d4"

#define BEECLOUD_APPID @"57004000-87b0-416d-8d53-1cc0da72acac"  //BeeCloud
#define BEECLOUD_TEST_SECRET @"33499179-6ba1-4ea5-8280-1cf609b58eae"    //BeeCloud
#define BEECLOUD_LIVE_SECRET @"92d94cff-d9b5-4a2b-8464-29a2f8049aa5"    //BeeCloud

#define JPUSH_KEY @"a667aee70a7319c9afb087c7"
#define JPUSH_SECRET @"d155c84ca66aa52a3c91a535"
#define UM_KEY  @"5a7f0736f43e484a4d0002d5"

#endif /* Constant_h */

/**
 *  注册通知与发送通知
 */
#pragma mark - Notification

#define addNObserver(_selector,_name) ([[NSNotificationCenter defaultCenter] addObserver:self selector:_selector name:_name object:nil])
#define removeNObserver(_name) ([[NSNotificationCenter defaultCenter] removeObserver:self name:_name object:nil])
#define postN(_name) ([[NSNotificationCenter defaultCenter] postNotificationName:_name object:nil userInfo:nil])
#define postNWithObj(_name,_obj) ([[NSNotificationCenter defaultCenter] postNotificationName:_name object:_obj userInfo:nil])
#define postNWithInfo(_name,_info) ([[NSNotificationCenter defaultCenter] postNotificationName:_name object:nil userInfo:_info])
